package org.springframework.nio.handler;

import java.lang.reflect.Method;

import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.nio.annotation.Handler;

public class NumHandlerMapping extends AbstractHanlderMapping<Integer> {

	@Override
	protected Integer getMappingForMethod(Method method, Class<?> handlerType) {
		Handler handler = AnnotationUtils.findAnnotation(method, Handler.class);
		Integer requestId = null;
		if(handler != null){
			short mainId = handler.mainId();
			short moudleId = handler.moudleId();
			
			requestId = ((mainId<<16) & 0xffffffff) | (moudleId & 0xffff);
		}
		return requestId;
	}

}
